'''
Created on 2011-1-8

@author: zarra
'''
import atexit
import threading
import cherrypy
import sys,os

PROJECT_PATH     = os.path.abspath(os.path.dirname(__file__))
PROJECT_Parent_PATH=os.path.split(PROJECT_PATH)[0]
print PROJECT_Parent_PATH
sys.path.extend( [os.path.join(PROJECT_Parent_PATH,'expr'),os.path.join(PROJECT_Parent_PATH,'zapple')])

import conf
from root import Root



def setup_server():
    # Set up site-wide config. Do this first so that,
    # if something goes wrong, we get a log.
    cherrypy.engine.SIGHUP = None
    cherrypy.engine.SIGTERM = None

    cherrypy.config.update({'environment': 'production',
                            #'log.screen': False,
                            #'log.error_file': 'site.log',
                            'show_tracebacks': True})
    
    cherrypy.tree.mount(Root(),conf.SITE_ROOT)

